package cn.xiaoke.fanxin.泛型数组;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Demo1 {

    public static void main(String[] args) {
        final String[] strArr = new String[10];
        strArr[0] = "str";
//        strArr[1] = 1;


//        final ArrayList<String>[] arr = new ArrayList<String>[10];

        ArrayList[] listArr1 = new ArrayList[10];
        ArrayList<String>[] listArr2 = new ArrayList[10];
//        listArr1 = listArr2;
        listArr2 = listArr1 ;

        final ArrayList<String> strList = new ArrayList<>();
        final ArrayList<Integer> IntList = new ArrayList<>();
        listArr1[0] = strList;
        listArr1[1] = IntList;

        final String s = listArr2[1].get(0);

        final List<ArrayList<Integer>> add = add(new ArrayList<Integer>(), new ArrayList<Integer>());

    }

//    @SafeVarargs
//    @SuppressWarnings("unchecked")
    public static <T> List<T> add(T...  listArr){
        listArr[0] = getList(true);
        listArr[1] = getList(false);
        return Arrays.asList(listArr);
    }






















    public static <T> T getList(boolean flag){
        if (flag){
            return (T) new ArrayList<String>();
        }
        return (T) new ArrayList<Integer>();
    }
}
